package com.server.modules.sys.utils.poibigdata;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.List;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;

import com.monitorjbl.xlsx.StreamingReader;


public class XxlsCustomerImport  {  
  
   
    
    public static void main(String[] args) throws Exception {  
    	//XxlsCustomerImport howto = new XxlsCustomerImport();  
    	long begin = System.currentTimeMillis();
    	System.out.println("begin:");
    	InputStream is = new FileInputStream(new File("D:/test/o.xlsx"));
    	Workbook workbook = StreamingReader.builder()
    	        .rowCacheSize(100)    // number of rows to keep in memory (defaults to 10)
    	        .bufferSize(4096)     // buffer size to use when reading InputStream to file (defaults to 1024)
    	        .open(is);            // InputStream or File for XLSX file (required)
    	int index=0;
    	for (Sheet sheet : workbook) {
			for (Row row : sheet) {
				for (Cell cell : row) {
					System.out.println(cell.getStringCellValue());
				}
				index++;
			}
		}
    	System.out.println(index);
    	           
    	    
    	    long end = System.currentTimeMillis();
    	System.out.println((end-begin)/1000+"s");
    	
    }  
   
}  

